package com.AX.mapper;

import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;
import java.util.Set;


//查询障碍物
@Mapper
public interface DynamicObstacleMapper {
    @Select("SELECT node_id FROM dynamic_obstacles " +
            "WHERE node_id IS NOT NULL " +
            "AND start_time <= NOW() AND end_time >= NOW() AND parking_lot_id = #{parkingLotId}")
    Set<String> findActiveBlockedNodes(Integer parkingLotId);

    @Select("SELECT edge_id, severity " +
            "FROM dynamic_obstacles " +
            "WHERE edge_id IS NOT NULL " +
            "AND start_time <= NOW() AND end_time >= NOW() AND parking_lot_id = #{parkingLotId}")
    @MapKey("edge_id")
    Map<Integer, Double> findActiveEdgeAdjustments(Integer parkingLotId);
}
